<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : feedInEditAccount.xsl
    Created on : June 9, 2013, 10:58 AM
    Author     : Thuc
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html"/>
    <xsl:param name="userID"></xsl:param>
    <!-- TODO customize transformation rules
         syntax recommendation http://www.w3.org/TR/xslt
    -->
    <xsl:template match="/">
        <xsl:choose>
            <xsl:when test="//feed[userlist/userId=$userID]">
                <ul id="feed-info-list">
                    <xsl:apply-templates select="//feed[userlist/userId=$userID]"/>
                </ul>
            </xsl:when>
            <xsl:otherwise>
                <h4>Chưa có feed nào trong danh sách.</h4>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template match="feed">     
            <li>
                <div class="rss-entry">
                <dl class="horizon-dl">
                    <dt>Tên feed</dt>
                    <dd>
                        <xsl:value-of select="title"/>
                    </dd>
                    <dt>Địa chỉ RSS</dt>
                    <dd>
                        <xsl:value-of select="url"/>
                    </dd>
                    <dt>Thông tin</dt>
                    <dd>
                        <xsl:value-of select="decription"/>
                    </dd>
                </dl>
                <div class="text-right">
                    <form action="removeFeedOfUser.action" method="post" onsubmit="return confirm('Bạn có muốn gỡ feed này?');">
                        <input type="hidden" name="rssID">
                            <xsl:attribute name="value">
                                <xsl:value-of select="feedId"/>
                            </xsl:attribute>
                        </input>
                        <input type="submit" class="button" value="Gỡ feed" />
                    </form>
                </div>
                </div>
            </li>
    </xsl:template>

</xsl:stylesheet>
